﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Kindohm.Life.Library
{
    public class MateFinder : ProximityFinder
    {
       
        Sex sex;
        Type type;

        public Creature FindIdealMate(Board board, Point start, int maxRange, Sex sex, Type type)
        {
            this.type = type;
            this.sex = sex;
            return this.FindNearestItem<Creature>(board, start, maxRange);
        }

        protected override bool ObjectIsValid<T>(T item) 
        {
            Creature creature = item as Creature;
            if (creature == null)
            {
                return false;
            }

            if (creature.Sex != this.sex)
            {
                return false;
            }

            if (!creature.IsHorny)
            {
                return false;
            }

            if (!creature.GetType().IsAssignableFrom(type))
            {
                return false;
            }

            return true;
        }



       
    }
}
